#!/usr/bin/env python
from Engine.Physics_object import Physics_object
import random
from Image.Animation import Animation

class Barrel(Physics_object):
    def __init__(self, level, il, x, y):
        self.animation = Animation(random.randint(0, 6), 6, 20, 1)
        self.main_image = il.nuke_barrel
        
        self.init(level, x, y, self.main_image[self.animation.image_index], (14, 0, 37, 64))
        
    def override_update(self, level, events):
        ret = self.animation.update()
        if ret != -1:
            self.image = self.main_image[ret]
            
    def get_new_instance(self, level, il):
        return Barrel(level, il, 0, 0)